package com.cy.pj.common.vo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @author zimin
 * @create 2019-07-08 17:52
 */
@Data
@NoArgsConstructor
public class PageObject<T> implements Serializable {

    private static final long serialVersionUID = 1536631092048817285L;
    //默认值为null,可自己写一个
    /**当前页的页码值*/
    private Integer pageCurrent=1;
    /**页面大小*/
    private Integer pageSize=3;
    /**总行数(通过查询获得)*/
    private Integer rowCount=0;
    /**总页数(通过计算获得)*/
    private Integer pageCount=0;
    /**当前页记录*/
    private List<T> records;

    public PageObject(Integer pageCurrent, Integer pageSize, Integer rowCount, Integer pageCount, List<T> records) {
        this.pageCurrent = pageCurrent;
        this.pageSize = pageSize;
        this.rowCount = rowCount;
        this.pageCount = (this.rowCount - 1) / this.pageSize + 1;
        this.records = records;
    }
}
